begintownscript;

variables;
short bmessage,pcs,seated,leadchar,rctx,rcty,stepsnd,can_train,pc_splvl;
string custom_m;

body;

beginstate INIT_STATE;
	set_incidental_sound(1);
	turn_off_training(1);

	if(get_flag(23,0) == 0){
		set_terrain(14,43,137);
		set_terrain(13,41,137);
		set_terrain(12,39,137);
		set_terrain(14,38,137);
		set_terrain(14,37,137);
		set_terrain(16,41,137);
		set_terrain(18,41,137);
		set_floor(12,39,37);
	}

	if(get_flag(15,1) < 5){
		force_instant_terrain_redraw();
		pause(6);

		reset_dialog();
		add_dialog_str(0,"The Red Fortress is...  truly beautiful, in a sickening and bloodshot way.  But the second floor is, if possible, even more ostentatious.",0);
		add_dialog_str(1,"There is a huge meeting room, and more of the stygian sculptures, red star emblems, the works...  It's as if The Immortal indulges in hellish imagery as if it were satin and fine dining.",0);
		add_dialog_str(2,"Oh!  But what about Hunter?",0);
		add_dialog_choice(0,"Good question...");
		bmessage = run_dialog(1);

		force_view_center(27,33);
		set_total_visibility(1);
		force_instant_terrain_redraw();
		pause(14);

		leadchar = 0;
		while(char_ok(leadchar) == FALSE){
			leadchar = (leadchar + 1);
		}
force_view_center(char_loc_x(leadchar),char_loc_y(leadchar));
		set_total_visibility(0);
		force_instant_terrain_redraw();
		pause(3);

		reset_dialog();
		add_dialog_str(0,"The battle seems to have went her way.  And yet, where is she?  She doesn't seem to be running upstairs.  What of the wizard in red?  She doesn't appear dead, yet he said that he would take care of her...",0);
		add_dialog_str(1,"So where is she?  What is she doing?  Is she okay?",0);
		add_dialog_choice(0,"Who knows.");
		bmessage = run_dialog(1);

		play_sound(95);
		reset_dialog();
		add_dialog_str(0,"It's not Katothen.  Someone else is trying to communicate.",0);
		add_dialog_str(1,"_Come to me.  I am in the northwestern corner of this floor...  Come to me, and I will show you your death!_",0);
		if(party_size() == 1){
			add_dialog_str(2,"It's the one who called himself 'Profanus Pyre', a subordinate of The Immortal.  Ah well-- if Rothgard wants me to deal with his lackeys, it's merely saving me the trouble of killing them later.",0);
			add_dialog_choice(0,"I'm coming for you!");
		}
		if(party_size() > 1){
			add_dialog_str(2,"It's the one who called himself 'Profanus Pyre'.  A subordinate of The Immortal.  Ah well-- if Rothgard wants us to deal with his lackeys, it's merely saving us the trouble of killing them later.",0);
			add_dialog_choice(0,"We're coming for you!");
		}
		bmessage = run_dialog(1);

		set_flag(15,1,5);
	}

	if(get_flag(15,1) >= 6)
		erase_char(8);

	if(get_flag(15,1) == 12){
		activate_hidden_group(5);
		if(party_size() == 1)
			message_dialog("Dr. Wu said he would be waiting for me in the meeting room.  The gates to my north are still closed, but the locks are undone.  He is expecting me.","");
		if(party_size() > 1)
			message_dialog("Dr. Wu said he would be waiting for us in the meeting room.  The gates to my north are still closed, but the locks are undone.  He is expecting us.","");
		set_flag(15,1,13);
	}

break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;
	if(get_flag(15,1) >= 12)
		activate_hidden_group(5);

	turn_off_training(1);
	can_train = 0;
	pcs = 0;
	while((pcs <= 3) && (can_train == 0)){
		if(char_ok(pcs) == TRUE){
			if((char_loc_x(pcs) >= 44) && (char_loc_y(pcs) >= 50))
				can_train = 1;
		}

		pcs = (pcs + 1);
	}
	if(can_train == 1)
		turn_off_training(0);

	if((get_flag(15,1) == 7) && (is_combat() == FALSE)){
		march_party(16,13);
		march_party(15,13);
		march_party(14,13);
		march_party(13,13);
		march_party(12,13);
		force_view_center(12,13);
		set_character_facing(1000,2);
		force_instant_terrain_redraw();
		pause(5);

		activate_hidden_group(4);
		force_instant_terrain_redraw();
		pause(6);

		reset_dialog();
		add_dialog_str(0,"_Ah!  So there you are.  The old man was right.  Hold on just a second here..._",0);
		add_dialog_str(1,"Hunter pulls a thin, red gem out of her pocket.",0);
		add_dialog_choice(0,"Wait, old man?");
		bmessage = run_dialog(1);

		set_character_pose(10,1);
		rctx = 12;
		while(rctx <= 22){
			set_height(rctx,9,12);
			set_terrain(rctx,9,392);
			set_height(rctx,17,12);
			set_terrain(rctx,17,390);
			rctx = (rctx + 1);
		}
		rcty = 10;
		while(rcty <= 16){
			set_height(11,rcty,12);
			set_terrain(11,rcty,379);
			set_height(23,rcty,12);
			set_terrain(23,rcty,391);
			rcty = (rcty + 1);
		}
		force_instant_terrain_redraw();
		play_sound(25);
		pause(5);

		set_character_pose(10,0);
		force_instant_terrain_redraw();
		pause(5);

		reset_dialog();
		add_dialog_str(0,"_The old man gave it to me.  A wizard in red, that is.  He called himself 'Dr. Wu', and I think he's a double agent working against the rakshasi.  Heck, if he's a wizard, than maybe he works for Katothen!_",0);
		add_dialog_str(1,"_He said that I'd find you here, and that I should free you.  Well, lo and behold-- here you are._",0);
		add_dialog_choice(0,"The wizard, Dr. Wu, is a rakshasa.");
		bmessage = run_dialog(1);

		reset_dialog();
		if(party_size() == 1)
			add_dialog_str(0,"I tell her that Katothen himself was absolutely sure that he is a rakshasa, and that his guise as a wizard is an illusion.",0);
		if(party_size() > 1)
			add_dialog_str(0,"We tell her that Katothen himself was absolutely sure that he is a rakshasa, and that his guise as a wizard is an illusion.",0);
		add_dialog_str(1,"_Wh...  what?  But then, why would he be helping us?  It makes no sense!  He has helped me, but he's with the enemy..._",0);
		add_dialog_choice(0,"He said something about portals downstairs.");
		bmessage = run_dialog(1);

		reset_dialog();
		add_dialog_str(0,"_Portals...?  Damnit, is Stewart out of his mind?!_",0);
		if(party_size() == 1){
			add_dialog_str(1,"She's talking about the Emperor.  That's good- it saves me the trouble of having to tell her that much.",0);
			add_dialog_str(2,"_Damn it all to hell!  We've been had-- we need to get downstairs immediately!  If we don't, this whole fortress will be overflowing with soldiers in no time!_",0);
			add_dialog_str(3,"She doesn't even wait for me to respond before running back towards the stairs.",0);
			add_dialog_choice(0,"I have to follow her!");
		}
		if(party_size() > 1){
			add_dialog_str(1,"She's talking about the Emperor.  That's good- it saves us the trouble of having to tell her that much.",0);
			add_dialog_str(2,"_Damn it all to hell!  We've been had-- we need to get downstairs immediately!  If we don't, this whole fortress will be overflowing with soldiers in no time!_",0);
			add_dialog_str(3,"She doesn't even wait for us to respond before running back towards the stairs.",0);
			add_dialog_choice(0,"We have to follow her!");
		}
		bmessage = run_dialog(1);

		erase_char(10);
		block_entry(1);
		set_flag(15,1,8);
	}

break;

beginstate 10;

	move_to_new_town(22,17,23);

break;

beginstate 11;

	move_to_new_town(22,47,23);

break;

beginstate 12;

	if(get_flag(15,1) < 6){
		if(is_combat() == TRUE){
			block_entry(1);
			end();
		}

		reset_dialog();
		add_dialog_str(0,"Profanus Pyre is standing here patiently, awaiting our duel.",0);
		add_dialog_choice(0,"Approach him.");
		add_dialog_choice(1,"No, not yet!");
		bmessage = run_dialog(0);

		if(bmessage == 2){
			block_entry(1);
			end();
		}
		erase_char(8);
		activate_hidden_group(1);
		relocate_character(6,20,13);

		leadchar = 0;
		while(char_ok(leadchar) == FALSE){
			leadchar = (leadchar + 1);
		}
		stepsnd = 0;

		if((char_loc_y(leadchar) >= 12) && (char_loc_y(leadchar) <= 14)){
			rctx = 8;
			while(rctx <= (11 + party_size())){
				march_party(rctx,13);
				force_view_center(rctx,13);
				force_instant_terrain_redraw();
				if(stepsnd == 0){
					stepsnd = 1;
					play_sound(49);
				}
				else{
					stepsnd = 0;
					play_sound(50);
				}
				pause(3);

				rctx = (rctx + 1);
			}
		}

		if(char_loc_y(leadchar) >= 16){
			rctx = 8;
			while(rctx <= (11 + party_size())){
				if((25 - rctx) >= 13){
					march_party(rctx,(25 - rctx));
					force_view_center(rctx,(25 - rctx));
				}
				else{
					march_party(rctx,13);
					force_view_center(rctx,13);
				}
				set_character_facing(1000,6);
				force_instant_terrain_redraw();
				if(stepsnd == 0){
					stepsnd = 1;
					play_sound(49);
				}
				else{
					stepsnd = 0;
					play_sound(50);
				}
				pause(3);

				rctx = (rctx + 1);
			}
		}

		if(char_loc_y(leadchar) <= 10){
			rctx = 8;
			while(rctx <= (11 + party_size())){
				if((rctx + 1) <= 13){
					march_party(rctx,(rctx + 1));
					force_view_center(rctx,(rctx + 1));
				}
				else{
					march_party(rctx,13);
					force_view_center(rctx,13);
				}
				set_character_facing(1000,6);
				force_instant_terrain_redraw();
				if(stepsnd == 0){
					stepsnd = 1;
					play_sound(49);
				}
				else{
					stepsnd = 0;
					play_sound(50);
				}
				pause(3);

				rctx = (rctx + 1);
			}
		}

		rctx = 12;
		while(rctx <= 22){
			set_height(rctx,9,13);
			set_terrain(rctx,9,451);
			set_height(rctx,17,13);
			set_terrain(rctx,17,451);
			rctx = (rctx + 1);
		}
		rcty = 10;
		while(rcty <= 16){
			set_height(11,rcty,13);
			set_terrain(11,rcty,451);
			set_height(23,rcty,13);
			set_terrain(23,rcty,451);
			rcty = (rcty + 1);
		}

		set_character_pose(6,1);
		force_instant_terrain_redraw();
		play_sound(25);
		pause(5);

		set_character_pose(6,0);
		force_instant_terrain_redraw();
		pause(2);

		rctx = 0;
		while(rctx <= get_ran(1,4,8)){
			pcs = 0;
			while(pcs <= 3){
				if(char_ok(pcs) == TRUE){
					set_character_facing(pcs, get_ran(1,0,7));
				}
				pcs = (pcs + 1);
			}
			force_instant_terrain_redraw();
			pause(3);

			rctx = (rctx + 1);
		}
		pcs = 0;
		while(pcs <= 3){
			if(char_ok(pcs) == TRUE){
				set_character_facing(pcs,6);
			}
			pcs = (pcs + 1);
		}
		force_instant_terrain_redraw();
		pause(3);

		reset_dialog();
		if(party_size() == 1)
			add_dialog_str(0,"_And now, we fight!  Prepare yourself to meet your maker!_",0);
		if(party_size() > 1)
			add_dialog_str(0,"_And now, we fight!  Prepare yourselves to meet your maker!_",0);
		add_dialog_choice(0,"Same to you!  Die!");
		bmessage = run_dialog(1);
		set_incidental_sound(0);
		set_flag(15,1,6);
		block_entry(1);
	}

break;

beginstate 13;

	if(get_flag(15,1) == 8){
		if(is_combat() == TRUE){
			block_entry(1);
			end();
		}

		set_total_visibility(1);
		force_view_center(32,23);
		force_instant_terrain_redraw();
		pause(5);

		text_bubble_on_char(12,"You...  Sabertooth...");
		force_instant_terrain_redraw();
		pause(7);

		text_bubble_on_char(11,"Yes.  We meet again.");
		force_instant_terrain_redraw();
		pause(7);

		text_bubble_on_char(12,"");
		force_instant_terrain_redraw();
		pause(7);

		text_bubble_on_char(11,"");
		force_instant_terrain_redraw();
		pause(2);

		text_bubble_on_char(11,"You seem incensed.  Good.");
		force_instant_terrain_redraw();
		pause(16);

		text_bubble_on_char(11,"");
		text_bubble_on_char(11,"Come with me.");
		force_instant_terrain_redraw();
		pause(14);

		text_bubble_on_char(11,"");
		text_bubble_on_char(11,"We will settle things.");
		force_instant_terrain_redraw();
		pause(16);

		text_bubble_on_char(11,"");
		text_bubble_on_char(12,"...");
		force_instant_terrain_redraw();
		pause(2);

		leadchar = 0;
		while(char_ok(leadchar) == FALSE){
			leadchar = (leadchar + 1);
		}
		if(char_loc_x(leadchar) < 32){
			march_party(26,26);
			force_instant_terrain_redraw();
			play_sound(49);
			pause(2);

			march_party(27,25);
			force_instant_terrain_redraw();
			play_sound(50);
			pause(2);

			march_party(28,24);
			force_instant_terrain_redraw();
			play_sound(49);
			pause(2);

			march_party(29,24);
			force_instant_terrain_redraw();
			play_sound(50);
			pause(2);
		}
		else{
			march_party(39,29);
			force_instant_terrain_redraw();
			play_sound(49);
			pause(2);

			march_party(38,28);
			force_instant_terrain_redraw();
			play_sound(50);
			pause(2);

			march_party(37,27);
			force_instant_terrain_redraw();
			play_sound(49);
			pause(2);

			march_party(36,26);
			force_instant_terrain_redraw();
			play_sound(50);
			pause(2);
		}

		text_bubble_on_char(leadchar,"Hunter!");
		force_instant_terrain_redraw();
		pause(4);

		text_bubble_on_char(12,"");
		text_bubble_on_char(12,"Fine, have it your way.");
		force_instant_terrain_redraw();
		pause(8);

		text_bubble_on_char(leadchar,"");
		text_bubble_on_char(leadchar,"What's going on?");
		force_instant_terrain_redraw();
		pause(8);

		text_bubble_on_char(12,"");
		text_bubble_on_char(12,"It's your grave, though.");
		force_instant_terrain_redraw();
		pause(8);

		text_bubble_on_char(leadchar,"");
		text_bubble_on_char(leadchar,"Who is this?!");
		force_instant_terrain_redraw();
		pause(8);

		text_bubble_on_char(12,"");
		text_bubble_on_char(11,"Very well.  Let's go.");
		force_instant_terrain_redraw();
		pause(8);

		text_bubble_on_char(leadchar,"");
		text_bubble_on_char(leadchar,"Wait!  Hunter!");
		force_instant_terrain_redraw();
		pause(8);

		text_bubble_on_char(11,"");
		set_character_pose(11,1);
		force_instant_terrain_redraw();
		pause(2);

		erase_char(12);
		put_boom_on_space(32,23,2,0);
		force_instant_terrain_redraw();
		run_animation_sound(10);
		pause(2);

		text_bubble_on_char(leadchar,"");
		set_character_pose(11,0);
		force_instant_terrain_redraw();
		pause(4);

		reset_dialog();
		add_dialog_str(0,"_Profanus Pyre...  He is a coward.  Show him what hatred is, even if he isn't cursed enough to see mine._",0);
		add_dialog_str(1,"Hunh?  Is this *another* villain?",0);
		add_dialog_choice(0,"Wait up-- who the hell are you?");
		bmessage = run_dialog(1);

		set_character_pose(11,1);
		force_instant_terrain_redraw();
		pause(2);

		erase_char(11);
		put_boom_on_space(32,21,2,0);
		force_instant_terrain_redraw();
		run_animation_sound(10);
		pause(2);

		reset_dialog();
		add_dialog_str(0,"Too late-- he's gone.",0);
		add_dialog_choice(0,"This is too much.");
		bmessage = run_dialog(0);
		if(char_loc_x(leadchar) < 32)
			force_view_center(29,24);
		else
			force_view_center(36,26);
		set_total_visibility(0);
		force_instant_terrain_redraw();
		set_flag(15,1,9);
		block_entry(1);
	}

break;

beginstate 14;

	if(is_combat() == TRUE){
		block_entry(1);
		end();
	}
	reset_dialog();
	if(party_size() == 1)
		add_dialog_str(0,"Finally!  A place to rest.  It's not much, but at least I'll be able to recoup a little.",0);
	if(party_size() > 1)
		add_dialog_str(0,"Finally!  A place to rest.  It's not much, but at least I'll be able to recoup a little.",0);
	add_dialog_choice(0,"No, not now...");
	add_dialog_choice(1,"Take a rest.");
	bmessage = run_dialog(1);
	if(bmessage == 1){
		block_entry(1);
		end();
	}
	change_char_energy(1000,9999);
	change_char_health(1000,9999);
	leadchar = 0;
	while(char_ok(leadchar) == FALSE){
		leadchar = (leadchar + 1);
	}
	if(char_loc_x(leadchar) > 12)
		teleport_party(12,49,1);
	else
		teleport_party(8,49,1);

break;

beginstate 15;

	if(get_flag(18,1) == 0){
		if(get_flag(23,0) == 0)
			message_dialog("The meeting room here seems to have a large representation of...  Sunset Creek!  And it's in intricate detail, too.  It might be a magical construct.","But something looks different...  The walls are torn down, and the barracks are obliterated.  Does this mean that the real Sunset Creek has also been destroyed?");
		if(get_flag(23,0) == 1)
			message_dialog("The meeting room here seems to have a large representation of...  Sunset Creek!  And it's in intricate detail, too.  It might be a magical construct.","It seems to be holding out for now.  How long this lasts is anyone's guess, but if this setup is any indication, it seems to be doing okay.");

		set_flag(18,1,1);
	}

break;

beginstate 16;

	if(is_combat() == TRUE){
		block_entry(1);
		end();
	}
	reset_dialog();
	add_dialog_str(0,"This is the portal that leads to The Immortal.",0);
	add_dialog_choice(0,"Do not enter.");
	add_dialog_choice(1,"Enter.");
	bmessage = run_dialog(0);
	if(bmessage == 1){
		block_entry(1);
		end();
	}
	set_total_visibility(0);
	pcs = 0;
	while(pcs <= 3){
		if(char_ok(pcs) == TRUE){
			relocate_character(pcs,1,1);
			put_boom_on_space(char_loc_x(pcs),char_loc_y(pcs), 2,0);
		}

		pcs = (pcs + 1);
	}
	force_instant_terrain_redraw();
	run_animation_sound(10);
	move_to_new_town(26,24,23);

break;

beginstate 17;

	reset_dialog();
	add_dialog_str(0,"There is a book on this shelf.",0);
	add_dialog_choice(1,"Leave it alone.");
	add_dialog_choice(2,"Read it.");
	bmessage = run_dialog(0);
	if(bmessage == 1)
		end();
	if(get_highest_skill(42) >= 7){
		pcs = 0;
		while(pcs <= 3){
			if(char_ok(pcs) == TRUE){
				pc_splvl = (12 - get_spell_level(pcs,0,6));
				if(pc_splvl > 0)
					change_spell_level(pcs,0,6, pc_splvl);
			}

			pcs = (pcs + 1);
		}

		if(party_size() == 1)
			message_dialog("This spellbook is fairly complex, but not outside of my grasp.  It teaches Ice Lances at level 12.","");
		if(party_size() > 1)
			message_dialog("This spellbook is fairly complex, but not outside of our grasp.  It teaches Ice Lances at level 12.","");
	}
	else{
		if(party_size() == 1)
			message_dialog("This book is obviously a spellbook.  Unfortunately, the code is very obscure, and my knowledge of Rune Reading simply isn't good enough to decipher it.","");
		if(party_size() > 1)
			message_dialog("This book is obviously a spellbook.  Unfortunately, the code is very obscure, and our knowledge of Rune Reading simply isn't good enough to decipher it.","");
	}

break;

beginstate 18;

	reset_dialog();
	add_dialog_str(0,"There is a book on this shelf.",0);
	add_dialog_choice(1,"Leave it alone.");
	add_dialog_choice(2,"Read it.");
	bmessage = run_dialog(0);
	if(bmessage == 1)
		end();
	if(get_highest_skill(42) >= 5){
		pcs = 0;
		while(pcs <= 3){
			if(char_ok(pcs) == TRUE){
				pc_splvl = (15 - get_spell_level(pcs,1,1));
				if(pc_splvl > 0)
					change_spell_level(pcs,1,1, pc_splvl);
			}

			pcs = (pcs + 1);
		}

		if(party_size() == 1)
			message_dialog("This spellbook is fairly complex, but not outside of my grasp.  It teaches Curing at level 15.","");
		if(party_size() > 1)
			message_dialog("This spellbook is fairly complex, but not outside of our grasp.  It teaches Curing at level 15.","");
	}
	else{
		if(party_size() == 1)
			message_dialog("This book is obviously a spellbook.  Unfortunately, the code is very obscure, and my knowledge of Rune Reading simply isn't good enough to decipher it.","");
		if(party_size() > 1)
			message_dialog("This book is obviously a spellbook.  Unfortunately, the code is very obscure, and our knowledge of Rune Reading simply isn't good enough to decipher it.","");
	}

break;

beginstate 19;

	reset_dialog();
	add_dialog_str(0,"There is a book on this shelf.",0);
	add_dialog_choice(1,"Leave it alone.");
	add_dialog_choice(2,"Read it.");
	bmessage = run_dialog(0);
	if(bmessage == 1)
		end();
	if(get_highest_skill(42) >= 7){
		pcs = 0;
		while(pcs <= 3){
			if(char_ok(pcs) == TRUE){
				pc_splvl = (6 - get_spell_level(pcs,1,10));
				if(pc_splvl > 0)
					change_spell_level(pcs,1,10, pc_splvl);
			}

			pcs = (pcs + 1);
		}

		if(party_size() == 1)
			message_dialog("This spellbook is fairly complex, but not outside of my grasp.  It teaches Mass Healing at level 6.","");
		if(party_size() > 1)
			message_dialog("This spellbook is fairly complex, but not outside of our grasp.  It teaches Mass Healing at level 6.","");
	}
	else{
		if(party_size() == 1)
			message_dialog("This book is obviously a spellbook.  Unfortunately, the code is very obscure, and my knowledge of Rune Reading simply isn't good enough to decipher it.","");
		if(party_size() > 1)
			message_dialog("This book is obviously a spellbook.  Unfortunately, the code is very obscure, and our knowledge of Rune Reading simply isn't good enough to decipher it.","");
	}

break;

beginstate 20;

	reset_dialog();
	add_dialog_str(0,"There is a book on this shelf.",0);
	add_dialog_choice(1,"Leave it alone.");
	add_dialog_choice(2,"Read it.");
	bmessage = run_dialog(0);
	if(bmessage == 1)
		end();
	if(get_highest_skill(42) >= 6){
		pcs = 0;
		while(pcs <= 3){
			if(char_ok(pcs) == TRUE){
				pc_splvl = (6 - get_spell_level(pcs,1,8));
				if(pc_splvl > 0)
					change_spell_level(pcs,1,8, pc_splvl);
			}

			pcs = (pcs + 1);
		}

		if(party_size() == 1)
			message_dialog("This spellbook is fairly complex, but not outside of my grasp.  It teaches Unshackle Mind at level 6.","");
		if(party_size() > 1)
			message_dialog("This spellbook is fairly complex, but not outside of our grasp.  It teaches Unshackle Mind at level 6.","");
	}
	else{
		if(party_size() == 1)
			message_dialog("This book is obviously a spellbook.  Unfortunately, the code is very obscure, and my knowledge of Rune Reading simply isn't good enough to decipher it.","");
		if(party_size() > 1)
			message_dialog("This book is obviously a spellbook.  Unfortunately, the code is very obscure, and our knowledge of Rune Reading simply isn't good enough to decipher it.","");
	}

break;

beginstate 21;

	reset_dialog();
	add_dialog_str(0,"There is a book on this shelf.",0);
	add_dialog_choice(1,"Leave it alone.");
	add_dialog_choice(2,"Read it.");
	bmessage = run_dialog(0);
	if(bmessage == 1)
		end();
	if(get_highest_skill(42) >= 6){
		if(get_flag(15,1) == 0){
			alter_stat(1000,25,3);

			if(party_size() == 1)
				message_dialog("This spellbook is fairly complex, but not outside of my grasp.  It teaches how to improve one's Magery in general.","");
			if(party_size() > 1)
				message_dialog("This spellbook is fairly complex, but not outside of our grasp.  It teaches how to improve one's Magery in general.","");
		}
		else{
			message_dialog("This book has, alas, nothing new to teach.","");
		}
	}
	else{
		if(party_size() == 1)
			message_dialog("This book is obviously a spellbook.  Unfortunately, the code is very obscure, and my knowledge of Rune Reading simply isn't good enough to decipher it.","");
		if(party_size() > 1)
			message_dialog("This book is obviously a spellbook.  Unfortunately, the code is very obscure, and our knowledge of Rune Reading simply isn't good enough to decipher it.","");
	}

break;

beginstate 22;

	reset_dialog();
	add_dialog_str(0,"There is a book on this shelf.",0);
	add_dialog_choice(1,"Leave it alone.");
	add_dialog_choice(2,"Read it.");
	bmessage = run_dialog(0);
	if(bmessage == 1)
		end();
	if(get_highest_skill(42) >= 6){
		if(get_flag(15,1) == 0){
			pcs = 0;
			while(pcs <= 3){
				if(char_ok(pcs) == TRUE){
					if((get_stat(pcs,2) >= 4) && (get_stat(pcs,12) >= 2)){
						award_char_xp(pcs,150,25);
					}
					else{
						alter_stat(pcs,2,(4 - get_stat(pcs,2)));
						alter_stat(pcs,12,(2 - get_stat(pcs,12)));
					}
				}

				pcs = (pcs + 1);
			}

			if(party_size() == 1)
				message_dialog("This spellbook is fairly complex, but not outside of my grasp.  It teaches how to improve one's Intelligence and Priestly skills in general.","");
			if(party_size() > 1)
				message_dialog("This spellbook is fairly complex, but not outside of our grasp.  It teaches how to improve one's Intelligence and Priestly skills in general.","");
		}
		else{
			message_dialog("This book has, alas, nothing new to teach.","");
		}
	}
	else{
		if(party_size() == 1)
			message_dialog("This book is obviously a spellbook.  Unfortunately, the code is very obscure, and my knowledge of Rune Reading simply isn't good enough to decipher it.","");
		if(party_size() > 1)
			message_dialog("This book is obviously a spellbook.  Unfortunately, the code is very obscure, and our knowledge of Rune Reading simply isn't good enough to decipher it.","");
	}

break;

beginstate 23;

	if(get_flag(17,1) == 0){
		if(party_size() == 1)
			message_dialog("This must be a personal reflection area for The Immortal...  The smell of incense hangs in the air, and there is a small pit of lava for, presumably, meditation.","It's quiet, but not particularly comforting.  But truth be told, in a fortress filled with people attempting to kill me, little will be.");
		if(party_size() > 1)
			message_dialog("This must be a personal reflection area for The Immortal...  The smell of incense hangs in the air, and there is a small pit of lava for, presumably, meditation.","It's quiet, but not particularly comforting.  But truth be told, in a fortress filled with people attempting to kill us, little will be.");
		set_flag(17,1,1);
	}

break;

beginstate 24;

	message_dialog("The books on this shelf aren't of any great military importance, but they mention a great deal about the _Solar Path_ and of _Sacred Indifference_ and many bizarre, unhinged and unexplained ideals.","It's all very confusing.  What is it doing here?");

break;

beginstate 25;

	message_dialog("At first, this book appears to be a spellbook.  The cover has a giant flame stitched into it.  The contents, however, are merely the ravings of a pyromaniac.  It is, in its own way, fascinating, but in no way useful.","");

break;

beginstate 26;

	message_dialog("This book is unmarked on the cover and is bound in red leather.  The interior is equally disturbing:  It is a sketchbook, but its owner has chosen to fill it with sketches of people being consumed in flames.  It's revolting in its accuracy.","");

break;

beginstate 27;

	message_dialog("The books on this shelf primarily concern themselves with stories of rebelling military officials and how they were put down by the Imperial Army.  Notes are written fastidiously in the margins.  Hmm...","");

break;

beginstate 28;

	message_dialog("This book is written by the last of the Ironclad Emperors, detailing his mindset before he was taken out by greedy generals, a popular revolution and his own widespread corruption.  It's fraught with overconfidence and self-aggrandizement.","");

break;

beginstate 30;

	reset_dialog();
	add_dialog_str(0,"There is a book on this pedestal.",0);
	add_dialog_choice(1,"Leave it alone.");
	add_dialog_choice(2,"Read it.");
	bmessage = run_dialog(0);
	if(bmessage == 1)
		end();
	if(get_highest_skill(42) >= 7){
		pcs = 0;
		while(pcs <= 3){
			if(char_ok(pcs) == TRUE){
				pc_splvl = (3 - get_spell_level(pcs,1,12));
				if(pc_splvl > 0)
					change_spell_level(pcs,1,12, pc_splvl);
			}

			pcs = (pcs + 1);
		}

		if(party_size() == 1)
			message_dialog("This spellbook is fairly complex, but not outside of my grasp.  It teaches Radiant Shield at level 3.","");
		if(party_size() > 1)
			message_dialog("This spellbook is fairly complex, but not outside of our grasp.  It teaches Radiant Shield at level 3.","");
	}
	else{
		if(party_size() == 1)
			message_dialog("This book is obviously a spellbook.  Unfortunately, the code is very obscure, and my knowledge of Rune Reading simply isn't good enough to decipher it.","");
		if(party_size() > 1)
			message_dialog("This book is obviously a spellbook.  Unfortunately, the code is very obscure, and our knowledge of Rune Reading simply isn't good enough to decipher it.","");
	}

break;

